home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / gnu.454 < prev    next >
Text File  |  1992-02-06  |  1KB  |  44 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f3\fmodern Courier;\f1\fmodern Ohlfs;}
  2. \paperw13040
  3. \paperh10200
  4. \margl120
  5. \margr120
  6. \pard\tx1152\tx2304\tx3456\tx4608\tx5760\tx6912\tx8064\tx9216\tx10368\tx11520\f0\b0\i0\ul0\fs28 cpp conditional compilation compiler preprocessor \
  7. \
  8. Q:  I thought that an #if 0 block will ignore everything inside it.  But it doesn't.\
  9. \
  10. A:  The ANSI standard says that #if statements only ignore syntactically correct code.  So if there are syntax errors, you will get an error.  Two particularly nasty ones are unterminated comments, and unterminated string constants.  See examples below.\
  11. \
  12. /tmp/foo.c contains:\
  13.  
  14. \f3 #ifdef NEVER \
  15. /* this is the start of \
  16. a comment that never ends\
  17. #endif\
  18.  
  19. \f0 \
  20. /lib/cpp /tmp/foo.c generates:\
  21.  
  22. \f3 /tmp/foo.c:1: unterminated #if conditional\
  23.  
  24. \f0 \
  25. Or, /tmp/foo.c contains:\
  26.  
  27. \f3 #ifdef NEVER\
  28. some words with a single quote ' OK\
  29. #endif\
  30.  
  31. \f0 \
  32. it generates:\
  33.  
  34. \f3 /tmp/foo.c:2: unterminated string constant\
  35. /tmp/foo.c:1: unterminated #if conditional
  36. \f0 \
  37. \
  38. QA454\
  39. \
  40. Valid for 1.0 \
  41. Valid for 2.0 \
  42. \
  43.  
  44.